@ECHO OFF

:: Updated for Sol v2.1 alpha 38

IF EXIST "acs.exe" (

    ECHO This script deletes Sol from your computer.

    CHOICE /C YN /M "Do you want to delete your Sol Config userfiles too?"
    IF ERRORLEVEL 2 GOTO soluninstall
    IF ERRORLEVEL 1 GOTO deleteuserfiles

    :deleteuserfiles
    FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`) DO (SET docsfolder=%%C)
    RD "%docsfolder%\Assetto Corsa\cfg\Sol" /s /q
    goto soluninstall

    :soluninstall
    DEL "%~dp0system\cfg\ppfilters\custom config example.ini" "%~dp0system\cfg\ppfilters\__Sol*.ini" "%~dp0system\cfg\ppfilters\sol_custom_configs\__Sol*.lua" "%~dp0system\cfg\ppfilters\sol_custom_configs\custom config example*.lua" "%~dp0extension\textures\color_grading\none.png" "%~dp0extension\textures\color_grading\__Sol_*.png" "%~dp0content\gui\icons\Sol *.png" /q
    FOR /d %%G in ("%~dp0apps\python\sol_*","%~dp0content\weather\sol_*","%~dp0extension\weather\simplePPoff","%~dp0extension\weather\sol","%~dp0extension\weather-controllers\sol*") DO RD /s /q "%%~G"
    RD "%~dp0system\cfg\ppfilters\sol_custom_configs"
    ECHO Sol successfully removed
    PAUSE
    DEL "%~dp0soluninstall.bat"
    EXIT
) ELSE (
    ECHO Please place soluninstall batchfile in AC rootfolder and try again.
    PAUSE
    EXIT
)

:soldocfolder
FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`) DO (SET docsfolder=%%C)
MKDIR "%docsfolder%\Assetto Corsa\cfg\Sol"
EXIT